home *** CD-ROM | disk | FTP | other *** search
- Subject: v24i081: SystemVr4/386 SLIP driver and utilities, Part04/04
- Newsgroups: comp.sources.unix
- Approved: rsalz@uunet.UU.NET
- X-Checksum-Snefru: 4e23e9ed 17183269 1fbff542 374cef7f
-
- Submitted-by: sudji@indo.intel.com (Sudji Husodo)
- Posting-number: Volume 24, Issue 81
- Archive-name: sysVr4386slip/part04
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: Makefile dialslip/Makefile dialslip/README.dialslip
- # dialslip/dslipuser.c dialslip/slip.config dialslip/slip.hosts
- # driver/ID/Node driver/ID/System driver/io/slip.mk
- # driver/sys/slip.h man/man1/slhangupd.1 utils/Makefile
- # utils/sldetach
- # Wrapped by rsalz@litchi.bbn.com on Fri Mar 22 11:57:14 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 4 (of 4)."'
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(239 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- X#
- X# Makefile file for SLIP
- X#
- X
- Xall:
- X cd driver/io; make -f slip.mk all install
- X cd utils; make all install
- X cd dialslip; make all install
- X
- Xclean:
- X cd driver/io; make -f slip.mk clean
- X cd utils; make clean
- X cd dialslip; make clean
- END_OF_FILE
- if test 239 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'dialslip/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'dialslip/Makefile'\"
- else
- echo shar: Extracting \"'dialslip/Makefile'\" \(460 characters\)
- sed "s/^X//" >'dialslip/Makefile' <<'END_OF_FILE'
- XCC = cc
- XCFLAGS = -O -DUSG -I/usr/ucbinclude
- XLDFLAGS =
- XLIBS = -L/usr/ucblib -lsocket -lnsl -lucb
- X
- Xall: dslipuser mkslipuser slip
- X
- Xdslipuser: dslipuser.o
- X $(CC) $(LDFLAGS) -o dslipuser dslipuser.o $(LIBS)
- X
- Xmkslipuser: mkslipuser.o
- X $(CC) $(LDFLAGS) -o mkslipuser mkslipuser.o $(LIBS)
- X
- Xslip: slip.o
- X $(CC) $(LDFLAGS) -o slip slip.o $(LIBS)
- X
- Xclean:
- X rm -f *.o mkslipuser dslipuser slip
- X
- Xinstall:
- X cp dslipuser mkslipuser slip /usr/sbin
- X chmod 4755 /usr/sbin/slip
- END_OF_FILE
- if test 460 -ne `wc -c <'dialslip/Makefile'`; then
- echo shar: \"'dialslip/Makefile'\" unpacked with wrong size!
- fi
- # end of 'dialslip/Makefile'
- fi
- if test -f 'dialslip/README.dialslip' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'dialslip/README.dialslip'\"
- else
- echo shar: Extracting \"'dialslip/README.dialslip'\" \(653 characters\)
- sed "s/^X//" >'dialslip/README.dialslip' <<'END_OF_FILE'
- X
- Xsrc/new/slip.h
- X edit to customize path names and line discipline
- X
- Xsrc/new/slip.config
- Xsrc/new/slip.hosts
- X move to location specified in slip.h
- X
- Xsrc/new/dslipuser.c
- X cc -O -o dslipuser dslipuser.c
- X
- Xsrc/new/mkslipuser.c
- X cc -O -o mkslipuser mkslipuser.c
- X
- Xsrc/new/slip.c
- X cc -O -o slip slip.c
- X
- XModifications:
- X01/31/91 Alan Batie
- X - Ported slip.c dslipuser.c mkslipuser.c for Unix System V/386
- X Release V.4.
- X
- X02/08/91 Sudji Husodo
- X - modified to log slip activities to /var/slip/slip.log if the file exists.
- X - changed the call to "system" to fork and exec, so we don't have to setuid
- X slattach and ifconfig to root.
- X
- END_OF_FILE
- if test 653 -ne `wc -c <'dialslip/README.dialslip'`; then
- echo shar: \"'dialslip/README.dialslip'\" unpacked with wrong size!
- fi
- # end of 'dialslip/README.dialslip'
- fi
- if test -f 'dialslip/dslipuser.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'dialslip/dslipuser.c'\"
- else
- echo shar: Extracting \"'dialslip/dslipuser.c'\" \(1444 characters\)
- sed "s/^X//" >'dialslip/dslipuser.c' <<'END_OF_FILE'
- X/*
- X * dslipuser.c
- X *
- X * Displays information on all of the users currently attached to the network.
- X *
- X * Copyright 1987 by University of California, Davis
- X *
- X * Greg Whitehead 10-1-87
- X * Computing Services
- X * University of California, Davis
- X *
- X * Revised: Geoff Arnold
- X * Sun Microsystems Inc.
- X * 10-28-87
- X */
- X
- X#include <stdio.h>
- X#include <ctype.h>
- X#include <sys/types.h>
- X#include <sys/file.h>
- X#include <sys/socket.h>
- X#include <netinet/in.h>
- X#include <arpa/inet.h>
- X#include <net/if.h>
- X#include <netdb.h>
- X#include <pwd.h>
- X#include "slip.h"
- X
- X#ifdef USG
- X# include <sys/fcntl.h>
- X#endif
- X
- Xmain(argc,argv)
- Xint argc;
- Xchar **argv;
- X{
- X int ufd;
- X struct sl_urec urec;
- X int free;
- X struct passwd *upass;
- X struct hostent *hh;
- X int n = 0;
- X int f = 0;
- X
- X /*
- X * Open USER_FL.
- X *
- X */
- X if ((ufd=open(USER_FL,O_RDONLY))<0) {
- X perror(USER_FL);
- X exit(1);
- X }
- X
- X
- X /*
- X * Display USER_FL.
- X *
- X */
- X while (read(ufd,&urec,sizeof(urec))==sizeof(urec)) {
- X if (urec.sl_uid >=0) {
- X n++;
- X upass=getpwuid(urec.sl_uid);
- X hh = gethostbyaddr(&urec.sl_haddr, 4, AF_INET);
- X printf("User %s connected as %s (%s) via %s%d\n",
- X upass->pw_name, hh->h_name, inet_ntoa(urec.sl_haddr),
- X IF_NAME,urec.sl_unit);
- X }
- X else
- X f++;
- X }
- X
- X if (n == 0)
- X printf("No dialup SLIP users connected.\n");
- X
- X printf("(%d free line%s)\n",f,(f==1)?"":"s");
- X
- X close(ufd);
- X}
- END_OF_FILE
- if test 1444 -ne `wc -c <'dialslip/dslipuser.c'`; then
- echo shar: \"'dialslip/dslipuser.c'\" unpacked with wrong size!
- fi
- # end of 'dialslip/dslipuser.c'
- fi
- if test -f 'dialslip/slip.config' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'dialslip/slip.config'\"
- else
- echo shar: Extracting \"'dialslip/slip.config'\" \(103 characters\)
- sed "s/^X//" >'dialslip/slip.config' <<'END_OF_FILE'
- X# slip.user configuration file
- X#
- X128.120.254.2
- X128.120.254.2
- X128.120.254.2
- X128.120.254.2
- X128.120.254.2
- END_OF_FILE
- if test 103 -ne `wc -c <'dialslip/slip.config'`; then
- echo shar: \"'dialslip/slip.config'\" unpacked with wrong size!
- fi
- # end of 'dialslip/slip.config'
- fi
- if test -f 'dialslip/slip.hosts' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'dialslip/slip.hosts'\"
- else
- echo shar: Extracting \"'dialslip/slip.hosts'\" \(142 characters\)
- sed "s/^X//" >'dialslip/slip.hosts' <<'END_OF_FILE'
- X# dialup slip host table - maps usercodes to host addresses
- X#
- X128.120.253.1 user1
- X128.120.253.2 user2
- X128.120.253.3 user3
- X128.120.253.4 user4
- END_OF_FILE
- if test 142 -ne `wc -c <'dialslip/slip.hosts'`; then
- echo shar: \"'dialslip/slip.hosts'\" unpacked with wrong size!
- fi
- # end of 'dialslip/slip.hosts'
- fi
- if test -f 'driver/ID/Node' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'driver/ID/Node'\"
- else
- echo shar: Extracting \"'driver/ID/Node'\" \(18 characters\)
- sed "s/^X//" >'driver/ID/Node' <<'END_OF_FILE'
- Xclone slip c slip
- END_OF_FILE
- if test 18 -ne `wc -c <'driver/ID/Node'`; then
- echo shar: \"'driver/ID/Node'\" unpacked with wrong size!
- fi
- # end of 'driver/ID/Node'
- fi
- if test -f 'driver/ID/System' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'driver/ID/System'\"
- else
- echo shar: Extracting \"'driver/ID/System'\" \(23 characters\)
- sed "s/^X//" >'driver/ID/System' <<'END_OF_FILE'
- Xslip Y 1 0 0 0 0 0 0 0
- END_OF_FILE
- if test 23 -ne `wc -c <'driver/ID/System'`; then
- echo shar: \"'driver/ID/System'\" unpacked with wrong size!
- fi
- # end of 'driver/ID/System'
- fi
- if test -f 'driver/io/slip.mk' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'driver/io/slip.mk'\"
- else
- echo shar: Extracting \"'driver/io/slip.mk'\" \(1464 characters\)
- sed "s/^X//" >'driver/io/slip.mk' <<'END_OF_FILE'
- X#
- X# Copyright 1991, Intel Corporation
- X# All rights reserved.
- X# Permission to use, copy, modify, and distribute this software and
- X# its documentation for any purpose and without fee is hereby granted,
- X# provided that the above copyright notice appear in all copies and
- X# that both the copyright notice appear in all copies and that both
- X# the copyright notice and this permission notice appear in
- X# supporting documentation, and that the name of Intel Corporation
- X# not be used in advertising or publicity pertaining to distribution
- X# of the software without specific, written prior premission.
- X#
- X# COMPANY AND/OR INTEL DISCLAIM ALL WARRANTIES WITH REGARD TO
- X# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- X# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO
- X# EVENT SHALL COMPANY NOR INTEL BE LIABLE FOR ANY SPECIAL,
- X# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- X# RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- X# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- X# OF THIS SOFTWARE.
- X#
- X
- X#
- X# Makefile for slip streams driver
- X#
- X
- XINC = ..
- XCFLAGS = -O -D_KERNEL $(MORECPP) -I$(INC)
- XOBJS = slip.o
- X
- Xall: Driver.o
- X
- XDriver.o: $(OBJS)
- X $(LD) -r -o $@ $(OBJS)
- X
- Xclean:
- X rm -rf *.o ../ID/Driver.o
- X
- Xinstall:
- X cd ../ID; cp ../io/Driver.o .
- X cp ../sys/slip.h /usr/include/sys
- X cd ../ID; idinstall -d slip; idinstall -a -k -mnspo slip
- END_OF_FILE
- if test 1464 -ne `wc -c <'driver/io/slip.mk'`; then
- echo shar: \"'driver/io/slip.mk'\" unpacked with wrong size!
- fi
- # end of 'driver/io/slip.mk'
- fi
- if test -f 'driver/sys/slip.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'driver/sys/slip.h'\"
- else
- echo shar: Extracting \"'driver/sys/slip.h'\" \(2449 characters\)
- sed "s/^X//" >'driver/sys/slip.h' <<'END_OF_FILE'
- X/*
- X * Copyright 1991, Intel Corporation
- X * All rights reserved.
- X *
- X * Permission to use, copy, modify, and distribute this software and
- X * its documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and
- X * that both the copyright notice appear in all copies and that both
- X * the copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Intel Corporation
- X * not be used in advertising or publicity pertaining to distribution
- X * of the software without specific, written prior premission.
- X *
- X * COMPANY AND/OR INTEL DISCLAIM ALL WARRANTIES WITH REGARD TO
- X * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- X * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO
- X * EVENT SHALL COMPANY NOR INTEL BE LIABLE FOR ANY SPECIAL,
- X * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- X * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- X * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- X * OF THIS SOFTWARE.
- X */
- X
- X/*
- X * Header file for Intel Unix System V/386 Release 4.0 SLIP streams driver.
- X */
- X
- Xtypedef struct {
- X u_int state; /* state of the entry */
- X u_int sap; /* service access point */
- X queue_t *qtop; /* upper streams read queue */
- X queue_t *qbot; /* lower streams write queue */
- X u_int qt_blocked; /* blocked upper write service flag */
- X pid_t pid; /* process id of application */
- X u_char *buf; /* incoming packet buffer */
- X u_int inlen; /* length of captured data */
- X short escape; /* flag if an ESC is detected */
- X short overrun; /* flag if incoming data exceeds SLIPMTU */
- X short flags; /* flag to be set (read/write) by user */
- X u_char uname[IFNAMSIZ]; /* slip interface unit name */
- X struct ifstats stats; /* slip interface statistics */
- X} slip_t;
- X
- X/* The following defines is taken from RFC 1005 */
- X
- X#define SLIPMTU 1006 /* maximum slip packet size */
- X
- X#define END 0300 /* frame end character */
- X#define ESC 0333 /* frame escape character */
- X#define ESC_END 0334 /* transposed frame end */
- X#define ESC_ESC 0335 /* transposed froam esc */
- X
- X/* the following are definitions for slip special I_STR ioctl */
- X
- X#define REG_SLHUP 1 /* i_str ioctl to register slip hangup daemon */
- X#define UNREG_SLHUP 2 /* i_str ioctl to unregister sl hangup daemon */
- END_OF_FILE
- if test 2449 -ne `wc -c <'driver/sys/slip.h'`; then
- echo shar: \"'driver/sys/slip.h'\" unpacked with wrong size!
- fi
- # end of 'driver/sys/slip.h'
- fi
- if test -f 'man/man1/slhangupd.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'man/man1/slhangupd.1'\"
- else
- echo shar: Extracting \"'man/man1/slhangupd.1'\" \(2194 characters\)
- sed "s/^X//" >'man/man1/slhangupd.1' <<'END_OF_FILE'
- X.\"
- X.\" Copyright 1991, Intel Corporation
- X.\" All rights reserved.
- X.\"
- X.\" Permission to use, copy, modify, and distribute this software and
- X.\" its documentation for any purpose and without fee is hereby granted,
- X.\" provided that the above copyright notice appear in all copies and
- X.\" that both the copyright notice appear in all copies and that both
- X.\" the copyright notice and this permission notice appear in
- X.\" supporting documentation, and that the name of Intel Corporation
- X.\" not be used in advertising or publicity pertaining to distribution
- X.\" of the software without specific, written prior permission.
- X.\"
- X.\" COMPANY AND/OR INTEL DISCLAIM ALL WARRANTIES WITH REGARD TO
- X.\" THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- X.\" MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO
- X.\" EVENT SHALL COMPANY NOR INTEL BE LIABLE FOR ANY SPECIAL,
- X.\" INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- X.\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- X.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
- X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- X.\" OF THIS SOFTWARE.
- X.\"
- X.TH slhangupd 1M "TCP/IP"
- X.SH NAME
- Xslhangupd \- slip hangup daemon
- X.SH SYNOPSIS
- X.nf
- X.ft B
- X/usr/sbin/slhangupd
- X.ft R
- X.fi
- X.SH DESCRIPTION
- X.PP
- XDue to the interworkings of the TCP/IP protocol stack, hangup signals
- Xfrom the tty may not reach \fIslattach\fP to notify it that the SLIP
- Xconnection has been lost.
- X\fBSlhangupd\fP is a daemon that receives messages from the \fISLIP\fP driver
- X(in the form of process IDs) and sends a SIGHUP signal to the specified
- Xprocess ID on behave of the tty.
- X.PP
- XWhen the \fISLIP\fP driver is first opened, it stores the process ID of
- Xthe program that did the open.
- XNormally, this will be \fIslattach\fP.
- XWhenever \fISLIP\fP receives a M_HANGUP message from the STREAMS driver under
- Xit (usually a tty driver), it sends the process ID of the program that did the
- Xinitial open to \fBslhangupd\fP.
- XWhen \fBslhangupd\fP receives the message, it sends a SIGHUP to the process ID
- Xspecified in the message.
- X.SH SEE ALSO
- Xslattach(1M), asy(7), slip(7)
- X.SH FILES
- X/dev/slip
- X.SH AUTHOR
- XSudji Husodo
- END_OF_FILE
- if test 2194 -ne `wc -c <'man/man1/slhangupd.1'`; then
- echo shar: \"'man/man1/slhangupd.1'\" unpacked with wrong size!
- fi
- # end of 'man/man1/slhangupd.1'
- fi
- if test -f 'utils/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'utils/Makefile'\"
- else
- echo shar: Extracting \"'utils/Makefile'\" \(1440 characters\)
- sed "s/^X//" >'utils/Makefile' <<'END_OF_FILE'
- X#
- X# Copyright 1991, Intel Corporation
- X# All rights reserved.
- X# Permission to use, copy, modify, and distribute this software and
- X# its documentation for any purpose and without fee is hereby granted,
- X# provided that the above copyright notice appear in all copies and
- X# that both the copyright notice appear in all copies and that both
- X# the copyright notice and this permission notice appear in
- X# supporting documentation, and that the name of Intel Corporation
- X# not be used in advertising or publicity pertaining to distribution
- X# of the software without specific, written prior premission.
- X#
- X# COMPANY AND/OR INTEL DISCLAIM ALL WARRANTIES WITH REGARD TO
- X# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- X# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO
- X# EVENT SHALL COMPANY NOR INTEL BE LIABLE FOR ANY SPECIAL,
- X# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- X# RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- X# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- X# OF THIS SOFTWARE.
- X
- X#
- X# Makefile for slip utilities
- X#
- X
- XCFLAGS=-O
- XLIBS=-lnsl
- XOBJS=slattach.o
- XPROGS=slattach slhangupd sldetach
- XTARGET=/usr/sbin
- X
- X.c.o:
- X $(CC) $(CFLAGS) -c $*.c
- X
- Xall: slattach slhangupd
- X
- Xslattach: $(OBJS)
- X $(CC) $(CFLAGS) $(OBJS) -o $@ $(LIBS)
- X
- Xclean:
- X rm -rf *.o slattach slhangupd
- X
- Xinstall:
- X cp $(PROGS) $(TARGET)
- END_OF_FILE
- if test 1440 -ne `wc -c <'utils/Makefile'`; then
- echo shar: \"'utils/Makefile'\" unpacked with wrong size!
- fi
- # end of 'utils/Makefile'
- fi
- if test -f 'utils/sldetach' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'utils/sldetach'\"
- else
- echo shar: Extracting \"'utils/sldetach'\" \(322 characters\)
- sed "s/^X//" >'utils/sldetach' <<'END_OF_FILE'
- X:
- X#
- X# sldetach removes the serial line that is being used for slip connection.
- X#
- X
- Xif [ $# != 1 ]; then
- X echo "Usage: sldetach interface"
- X exit 1
- Xfi
- X
- Xps=`ps -ef | grep -v grep | grep slattach | grep $1`
- X
- Xif [ "$ps" != "" ]; then
- X kill -1 `echo $ps | nawk '{print $2}'`
- Xelse
- X echo "sldetach: interface unit $1 not found"
- Xfi
- END_OF_FILE
- if test 322 -ne `wc -c <'utils/sldetach'`; then
- echo shar: \"'utils/sldetach'\" unpacked with wrong size!
- fi
- chmod +x 'utils/sldetach'
- # end of 'utils/sldetach'
- fi
- echo shar: End of archive 4 \(of 4\).
- cp /dev/null ark4isdone
- MISSING=""
- for I in 1 2 3 4 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 4 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-